package com.buiminhthang.food;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class LoginActivity extends Activity {
	EditText edEmail, edPass;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login);
		TextView slogan = (TextView) findViewById(R.id.slogan);
		TextView slogan_fa = (TextView) findViewById(R.id.slogan_fa);
		TextView bt_login = (TextView) findViewById(R.id.bt_login);
		TextView tv_connect = (TextView) findViewById(R.id.connect);
		TextView tv_facebook = (TextView) findViewById(R.id.facebook);
		edEmail = (EditText) findViewById(R.id.ed_email);
		edPass = (EditText) findViewById(R.id.ed_pass);
		Typeface custom_font = Typeface.createFromAsset(getAssets(),
				"fonts/Lato-Bold.ttf");
		Typeface custom_font2 = Typeface.createFromAsset(getAssets(),
				"fonts/times-new-roman.ttf");
		Typeface custom_font3 = Typeface.createFromAsset(getAssets(),
				"fonts/Lato-Light.ttf");
		slogan.setTypeface(custom_font);
		slogan_fa.setTypeface(custom_font2);
		bt_login.setTypeface(custom_font);
		edEmail.setTypeface(custom_font3);
		edPass.setTypeface(custom_font3);
		tv_connect.setTypeface(custom_font3);
		tv_facebook.setTypeface(custom_font);

	}

	public void login_bt(View v) {
		String email = edEmail.getText().toString();
		String pass = edPass.getText().toString();

		if (edEmail.getText().toString().equals("abc@gmail.com")
				&& edPass.getText().toString().equals("abc")) {
			startActivity(new Intent(LoginActivity.this, FoodActivity.class));
			Toast.makeText(LoginActivity.this, "Successful login",
					Toast.LENGTH_SHORT).show();
			this.finish();
		} else if (edEmail.getText().toString().equals("")
				| edPass.getText().toString().equals("")) {

			Toast.makeText(LoginActivity.this,
					"Please enter email and password!", Toast.LENGTH_SHORT)
					.show();
		} else {
			Toast.makeText(LoginActivity.this, "Wrong password!",
					Toast.LENGTH_SHORT).show();
		}

	}

	public void connectfb(View v) {

	}
}
